package com.wanxi.uitl;

import java.io.File;
import java.io.IOException;

public class IOTool {
    private IOTool() {

    }

    public static String getDirPath(String path) {
        File file = new File(path);
        file.mkdirs();
        return file.toString();
    }

    public static File getDirFile(String path) {
        File file = new File(path);
        file.mkdirs();
        return file;
    }

    public static File createFile(String path, String fileName) {
        File dir = getDirFile(path);//创建文件夹
        File file = new File(dir, fileName);
        if (file.exists()) {
            file.delete();
        }
        try {
            file.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return file;
    }
}
